package cn.stylefeng.guns.sys.modular.system.service;

import cn.stylefeng.guns.base.pojo.page.LayuiPageInfo;
import cn.stylefeng.guns.sys.modular.system.entity.QuartzTask;
import cn.stylefeng.guns.sys.modular.system.model.params.QuartzTaskParam;
import cn.stylefeng.guns.sys.modular.system.model.result.QuartzTaskResult;
import com.baomidou.mybatisplus.extension.service.IService;
import org.quartz.SchedulerException;

import java.util.List;

/**
 * jobService
 *
 * @author jiangge
 */
public interface QuartzTaskService extends IService<QuartzTask> {


    /**
     * 新增
     *
     * @author jiangge
     * @Date 2020-10-20
     */
    void add(QuartzTaskParam param);

    /**
     * 删除
     *
     * @author jiangge
     * @Date 2020-10-20
     */
    void delete(QuartzTaskParam param);

    /**
     * 更新
     *
     * @author jiangge
     * @Date 2020-10-20
     */
    void update(QuartzTaskParam param);

    /**
     * 查询单条数据，Specification模式
     *
     * @author jiangge
     * @Date 2020-10-20
     */
    QuartzTaskResult findBySpec(QuartzTaskParam param);

    /**
     * 查询列表，Specification模式
     *
     * @author jiangge
     * @Date 2020-10-20
     */
    List<QuartzTaskResult> findListBySpec(QuartzTaskParam param);

    /**
     * 查询分页数据，Specification模式
     *
     * @author jiangge
     * @Date 2020-10-20
     */
    LayuiPageInfo findPageBySpec(QuartzTaskParam param);

    QuartzTask get(Long id);

    int update(QuartzTask taskScheduleJob);

    int remove(Long id);

    int removeBatch(Long[] ids);

    void initSchedule() throws SchedulerException;

    void changeStatus(Long jobId, String jobStatus) throws SchedulerException;

    void updateCron(Long jobId) throws SchedulerException;

    void run(QuartzTask scheduleJob) throws SchedulerException;
}
